<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">

    <link rel="stylesheet" href="/css/global.css" media="all">
    <link rel="stylesheet" href="/plugins/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="/plugins/font-awesome/css/font-awesome.min.css">
    <script type="text/javascript" src="/plugins/layui/layui.js"></script>
    <title>编辑app下载地址</title>
</head>
<body>
<div style="margin: 15px;">
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
        <legend>编辑app下载地址(<label class="layui-required-tip">标红的为必填项</label>)</legend>
    </fieldset>

    <form id="layui-form" class="layui-form" action="" method="post">
        <input type="text" name="id" class="layui-input" value="${download.id!}" style="display: none;">
        <div class="layui-form-item">
            <label class="layui-form-label layui-required-tip">下载地址：</label>
            <div class="layui-input-block">
                <input type="text" id="downloadUrl" name="downloadUrl" lay-verify="required"
                       placeholder="下载地址" autocomplete="off" class="layui-input" value="${download.downloadUrl!}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">类型：</label>
            <div class="layui-input-block">
                <#if download.appType?? && download.appType=="1">
                        <input type="radio" name="appType" value="1" title="IOS" checked/>
                        <input type="radio" name="appType" value="2" title="Android"/>
                    <#else>
                        <input type="radio" name="appType" value="1" title="IOS"/>
                        <input type="radio" name="appType" value="2" title="Android" checked/>
                </#if>
            </div>
        </div>
<!--        <div class="layui-form-item">
            <label class="layui-form-label">状态：</label>
            <div class="layui-input-block">
                <#if download.enableFlag?? && download.enableFlag == true>
                            <input type="radio" name="enableFlag" value="1" title="启用" checked/>
                            <input type="radio" name="enableFlag" value="0" title="停用" />
                    <#else>
                        <input type="radio" name="enableFlag" value="1" title="启用" />
                        <input type="radio" name="enableFlag" value="0" title="停用" checked/>
                </#if>
            </div>
        </div>-->
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="save">保存</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                <a href="/manage/appDownload/dlManage" class="layui-btn">返回</a>
            </div>
        </div>
    </form>
</div>
<script>
    layui.use(['form','jquery'],function () {
        var form = layui.form,$ = layui.jquery;

        form.on('submit(save)', function(data){
            $.ajax({
                type : "post",
                url : "/manage/appDownload/updateDl",
                dataType : "json",
                data :data.field,
                success : function(result) {
                    if (result.code >= 0) {
                        location.href = "/manage/appDownload/dlManage";
                    }else{
                        layer.msg(result.msg, { icon: 7, shift: 6 });
                    }
                }
            });
            return false;
        });
    })
</script>
</body>
</html>